import 'package:flutter/material.dart';

class MyText extends StatelessWidget {
  //显示的文字内容
  final String text;

  //文字的颜色
  final Color? color;

  //字体大小 设计图内的大小
  final double? fontSize;

  //宽度 设计图内的高度
  final double? height;

  //字体宽度
  final FontWeight? fontWeight;

  //最大行
  final int? maxLines;

  //对其方式
  final TextAlign? textAlign;

  //溢出模式
  final TextOverflow? overflow;

  //文字装饰
  final TextDecoration? decoration;

  //文字样式
  final TextStyle? style;

  const MyText(
    this.text, {
    Key? key,
    this.color,
    this.fontSize,
    this.fontWeight,
    this.maxLines,
    this.textAlign,
    this.overflow,
    this.height,
    this.decoration,
    this.style,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Text(
      text,
      maxLines: maxLines,
      textAlign: textAlign,
      overflow: overflow,
      style: style ??
          TextStyle(
            color: color,
            height: height,
            decoration: decoration,
            fontSize: fontSize,
            fontWeight: fontWeight,
          ),
    );
  }
}
